<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script src="js/jquery-2.1.4.min.js">
	
</script>
<script >
	function test(){
		$.ajax({
			url:"AjaxServlet",
			type:"post",
			data:{userName:$("#a").val(),password:$("#b").val(),flag:"demo2"},
			success:function(data){
				$("#label1").html(data);
			}
		});
		
		
	}
</script>
</head>
<body>
<form action="AjaxServlet?flag=demo1" method = "post">
	<input name = "userName">
	<input name = "password">
	<input name = "age">
	
	<input type = "submit">
	
</form>
${msg}


	<input id = "a">
	<input id = "b">

<button onclick="test()">ajax请求</button>
<label id="label1"></label>
</body>
</html>